package com.gexiaobao.pigeon.ui.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.gexiaobao.pigeon.R
import com.gexiaobao.pigeon.app.base.DataBindBaseViewHolder
import com.gexiaobao.pigeon.app.ext.Constant
import com.gexiaobao.pigeon.app.model.bean.FeatherColorResponse
import com.gexiaobao.pigeon.app.model.bean.OrderDrippingDetailResponse
import com.gexiaobao.pigeon.app.util.KvUtils
import com.gexiaobao.pigeon.databinding.ItemOrderDetailPigeonListBinding
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken

/**
 * @Author      : hxw
 * @Date        : 2024/7/1 10:16
 * @Describe    :
 */
class DrippingOrderDetailPigeonListAdapter(data: ArrayList<OrderDrippingDetailResponse.ListPigeonInfo.PigeonsList>) :
    BaseQuickAdapter<OrderDrippingDetailResponse.ListPigeonInfo.PigeonsList, DataBindBaseViewHolder>(R.layout.item_order_detail_pigeon_list, data) {
    override fun convert(holder: DataBindBaseViewHolder, item: OrderDrippingDetailResponse.ListPigeonInfo.PigeonsList) {
        val binding = DataBindBaseViewHolder.getBinding(holder) as ItemOrderDetailPigeonListBinding
        binding.data = item
        binding.executePendingBindings()//防止列表抖动

        holder.setText(R.id.tvPigeonNumber, (holder.layoutPosition + 1).toString())

        val sex = when (item.sex) {
            2 -> context.getString(R.string.hint_female)
            3 -> context.getString(R.string.hint_male)
            else -> context.getString(R.string.unkown)
        }
        holder.setText(R.id.tvItemOrderDetailPigeonListSex, sex)

        val eyePattern = when (item.eyePattern) {//眼沙 1-未知 2-黄,3-砂 4-牛
            1 -> context.getString(R.string.unkown)
            2 -> context.getString(R.string.Xyridaceae)
            3 -> context.getString(R.string.sand_hole)
            else -> context.getString(R.string.buphthalmos)
        }
        holder.setText(R.id.tvItemOrderDetailPigeonListEyePattern, eyePattern)
    }
}